﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrderNotice.aspx.cs" Inherits="Business_Notics_OrderNotice"
    Theme="normal" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>短信管理</title>
    <link href="../../css/MessageTable.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../js/MobileJS.js"></script>
    <script type="text/javascript">
    String.prototype.len=function()   
    {   
          return   this.replace(/[^\x00-\xff]/g,"**").length;   
    }  
    
    
    function MsgContentOnChanging()
    {
        var msgcontent = document.getElementById('tb_MsgContent');
        var span_split = document.getElementById('span_split');
        
        var msgcount = msgcontent.value.len();
        if(msgcount > 0)
        {
            span_split.innerHTML = "当前输入了" + msgcount + "个字符";
            if(msgcount >130 && msgcount<1001)
            {
                span_split.innerHTML = "<span style='color:red; font-weight:bold'>当前输入了" + msgcount + "个字符，共拆分成"+ ((msgcount/130|0)+1) +"条短信。</span>" ;
  
            }
            else
            {
               if(msgcount>1000)
               {
                  span_split.innerHTML = "<span style='color:red; font-weight:bold'>内容过长，请注意</span>";
  
               }
            }
        }
        if(msgcount == 0)
        {        
//            span_split.innerHTML = '&nbsp;';
        }
    }
   function check(obj)     
   {   
//        var   txt1=document.all.txt.value;   
        var re=/[^\x00-\xff]/g;   
        return re.test(obj) ;
        //alert(re.test(obj)); 
   }
   
  
   
   //验证事件 this.tb_Mobile.Attributes.Add("onblur", "select_onblurAll()");
//gwh 20100221 追加内容判断
function select_onblurAll()
{
    var flag = false;
    var text1 = document.getElementById('tb_Mobile');
    var spanforerror = document.getElementById('spanforError');
        
    var text1content = document.getElementById('tb_MsgContent');
    var spanforerrorcontent = document.getElementById('span_split');
        
    
    if(tb_Mobile_IsNull(text1content))
    {
        spanforerrorcontent.innerHTML = "<span style='color:red; font-weight:bold'>请填写短信内容</span>";
        return flag;
    }    
    

        
        if(text1content.value.len() > 1000)
        {
        spanforerrorcontent.innerHTML = "<span style='color:red; font-weight:bold'>内容过长，请注意</span>";
         return flag;
    }    
    
    
    if(tb_Mobile_IsNull(text1))
    {
        spanforerror.innerHTML = "<span style='color:red; font-weight:bold'>请选择或填写至少一个手机号码</span>";
        return flag;
    }
    
    if(text1.value.length >0)
    {
        var arraryText1 = text1.value.trim().split(',');
        for(var i =0;i<arraryText1.length;i++)
        {
            if(arraryText1[i].length >0)
            {
                if(arraryText1[i].length != 11)
                {
                    spanforerror.innerHTML = "<span style='color:red; font-weight:bold'>号码\"" + arraryText1[i] + "\"不是有效的手机号码！</span>";
                    flag = false;
                    break;
                }
                if(!checkMobile(arraryText1[i]))
                {
                    flag = false;
                    spanforerror.innerHTML = "<span style='color:red; font-weight:bold'>号码\"" + arraryText1[i] + "\"不是有效的天翼手机号码！</span>";
                    break;
                }
                spanforerror.innerHTML = "";
                flag = true;
                continue;
            }
        }
    }
    
    return flag;
}  
   
    </script>

</head>
<body style="background-color: #fcf6ec">
    <form id="form1" runat="server">
        <asp:ScriptManager ID="Scriptmanager1" runat="server" EnableScriptGlobalization="true"
            EnableScriptLocalization="true">
            <%--<Scripts>
                <asp:ScriptReference Path="../../js/MobileJS.js" />
            </Scripts>--%>
        </asp:ScriptManager>
        <div>
            <div class="normalnav">
                <div class="normalcontent">
                    <span style="color: #ffffff">短信管理>>></span><span style="color: #f6ff00">短信发送</span></div>
            </div>
            <table border="2" cellpadding="5" cellspacing="1" bordercolor="#edc789" style="width: 98%;
                text-align: center; background-color: #ffffff; border-collapse: collapse; margin-left: 10px;
                top: 40px; position: absolute;">
                <!--消息内容-->
                <tr>
                    <td align="right" style="width: 20%">
                        <%--<span style="color: Red;">*</span>消息内容：</td>
                    <td style="width:70%; text-align:left; border:1px;" colspan="3">--%>
                        <span style="color: Red; overflow: hidden;">*</span> <span style="overflow: hidden;">
                            消息内容：</span></td>
                    <td style="width: 200px; text-align: left; border-right: 0px;" colspan="2">
                        <asp:TextBox ID="tb_MsgContent" runat="server" Width="250px" MaxLength="1000" BorderWidth="1px"
                            Height="80px" TextMode="MultiLine" Text=""></asp:TextBox>
                    </td>
                    <td style="vertical-align: top; text-align: left; border-left: 0px;">
                        <asp:Label ID="Label1" runat="server" Text="请填写内容，建议不超过65个汉字(130个字符)"></asp:Label>
                        <br />
                        <br />
                        <span id="span_split"></span>
                        <%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="tb_MsgContent"
                            Display="Dynamic" ErrorMessage="<span class=reshow>(*)请填写消息内容！</span>"></asp:RequiredFieldValidator>--%>
                    </td>
                </tr>
                <!--添加手机号码-->
                <tr>
                    <td align="right" style="width: 20%">
                        <span style="color: Red; overflow: hidden;">*</span> <span style="overflow: hidden;">
                            添加手机号码：</span></td>
                    <td style="width: 200px; text-align: left; border-right: 0px;" colspan="2">
                        <asp:TextBox ID="tb_Mobile" runat="server" Width="250px" BorderWidth="1px" Height="80px"
                            TextMode="MultiLine"></asp:TextBox>
                    </td>
                    <td style="vertical-align: top; text-align: left; border-left: 0px;">
                        <asp:Label ID="lbl_Mobile" runat="server" Text="请添加手机号码，多个手机号码请用英文状态下的逗号分隔"></asp:Label>
                        <br />
                        <%--<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                            ErrorMessage="请至少选择或填写一个手机号码！" ControlToValidate="tb_Mobile">
                        </asp:RequiredFieldValidator>--%>
                        <br />
                        <span id="spanforError"></span>
                    </td>
                </tr>
                <!--参与人-->
                <tr style="display: none">
                    <td align="right" style="width: 20%; height: 150px;" valign="top">
                        <span style="color: Red;">*</span>参与人：</td>
                    <td style="width: 200px; text-align: left; border: 0px;" colspan="2">
                        <div style="display: inline;">
                            <asp:ListBox ID="ListBox1" runat="server" Width="252px" SelectionMode="Multiple"
                                Height="146px"></asp:ListBox>&nbsp;
                        </div>
                    </td>
                    <td style="border: 0px; text-align: left; vertical-align: top;">
                        <asp:CheckBox ID="cb_SelectAll" runat="server" Text="全选" />
                        <br />
                        <asp:Button ID="btn_AddContact" runat="server" Text=" 添加联系人 " OnClick="btn_AddContact_Click"
                            CssClass="buttons" CausesValidation="false" />
                        <br />
                    </td>
                </tr>
                <!--发送方式-->
                <tr>
                    <td align="right" style="width: 20%;" valign="top">
                        <span style="color: Red;">*</span>发送方式：</td>
                    <%--                    <td style="width:90%; text-align:left;" colspan="3">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                        <asp:RadioButton ID="rb_Now" runat="server" Text="立即" GroupName="SendTime" AutoPostBack="true" OnCheckedChanged="rb_Now_CheckedChanged" Checked="true"/>
                        
                        <asp:RadioButton ID="rb_Timing" runat="server" Text="定时" GroupName="SendTime" OnCheckedChanged="rb_Timing_CheckedChanged" AutoPostBack="true"/>
                        <div runat="server" visible="false" style="margin-left:2px;" id="div_Timing">
                            <asp:TextBox ID="tb_SendTime" Width="80px" runat="server" ></asp:TextBox>
                            <asp:ImageButton runat="Server" ID="ibtn_SendTime" ImageUrl="~/Images/Calendar_scheduleHS.png" 
                                CausesValidation="false" AlternateText="点击选择日期"/>
                            <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="tb_SendTime"
                                Format="yyyy-MM-dd" PopupButtonID="ibtn_SendTime"/>
                            <asp:DropDownList ID="ddl_SendHour" runat="server">
                            </asp:DropDownList>时
                            <asp:DropDownList ID="ddl_SendMinite" runat="server">
                            </asp:DropDownList>分
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server"
                                 ErrorMessage="<span style='color:red; font-size:13px'>发送日期格式不正确！</span>" ControlToValidate="tb_SendTime" Display="Dynamic" 
                                 ValidationExpression="^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$">
                            </asp:RegularExpressionValidator>
                            
                        </div>                      
                        </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>--%>
                    <td style="width: 550px; text-align: left;" colspan="3" id="TD1" runat="server">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                <asp:RadioButton ID="rb_Now" runat="server" Text="立即" GroupName="SendTime" AutoPostBack="true"
                                    OnCheckedChanged="rb_Now_CheckedChanged" Checked="true" />
                                <asp:RadioButton ID="rb_Timing" runat="server" Text="定时" GroupName="SendTime" OnCheckedChanged="rb_Timing_CheckedChanged"
                                    AutoPostBack="true" />
                                <asp:TextBox ID="tb_SendTime" Width="80px" runat="server"></asp:TextBox>
                                <asp:ImageButton runat="Server" ID="ibtn_SendTime" ImageUrl="~/Images/Calendar_scheduleHS.png"
                                    CausesValidation="false" AlternateText="点击选择日期" />
                                <ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="tb_SendTime"
                                    Format="yyyy-MM-dd" PopupButtonID="ibtn_SendTime" />
                                <asp:DropDownList ID="ddl_SendHour" runat="server">
                                </asp:DropDownList>时
                                <asp:DropDownList ID="ddl_SendMinite" runat="server">
                                </asp:DropDownList>分
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ErrorMessage="<span style='color:red; font-size:13px; font-weight:bold;'>发送日期格式不正确！</span>"
                                    ControlToValidate="tb_SendTime" Display="Dynamic" ValidationExpression="^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$">
                                </asp:RegularExpressionValidator>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                    </td>
                </tr>
                <tr>
                    <td align="left" class="navi_link" colspan="4">
                        <input type="image" name="submit" id="submit" src="../../Images/Basic/tianjia.gif"
                            onserverclick="btnSave_Click" runat="server" />
                        发送
                    </td>
                </tr>
            </table>
        </div>
    </form>
</body>
</html>
